<div class="box_shadow group_box mt10" >
<div class="groupbg">
<h3 class="f16 bold">您也许在找...</h3>
<div id="J_FindGoods">
<div class="finding">

<div class="finds clearfix">

<volist name="this_cate_group" key="key" id='val'>
<a class="finds-item" href="{:u('item/index',array('id'=>$val['id']))}" data-likeCnt="89" data-commentCnt="89" data-saleCnt="0" ><img title="{$val.title}" alt="{$val.title}" url="{:base64_encode($val['img'])}" class="encode_url" /><div class="price">¥{$val.price}</div></a>
</volist>

</div>
</div>
<div class="finding-stat clearfix item_b" id="J_FindsCount"><div class="items_likes fr"><a href="javascript:;" class="img_album_btn" iid="2520"><em></em>加入专辑</a><a href="javascript:;" class="like_btn" iid="2520" iurl="http://www.baobeitaotao.com/item-2520.html"></a><em class="red bold comment-num" id="like_num_2520">4005</em>
</div>
</div>
</div>

<div class="another clearfix"><div class="tick-bar"><div class="ticking"></div><div class="tick-txt"><em>10</em>秒后离你而去</div></div><span class="follow_red_btn tc cursor fr" style="width:45px; height:30px;"><a class="white" id="J_ChangeGroupBtn" style="line-height:30px;" href="javascript:;" data-proId="1004427" data-index="1" data-cate="23" data-tagids="   2117,   2102,   785,   2118,   660  " data-minid="1003116">换</a></span></div></div><style type="text/css">
.img_album_btn{
padding: 2px;
text-align: center;
bottom: 55px;
left:12px;
}
.price {
position: absolute;
background: black;
bottom: 0pt;
right: 0pt;
color: white;
opacity: 0.5;
width: 35px;
height: 25px;
line-height: 25px;
}
		.finding {
width: 200px;
height: 200px;
overflow: hidden;
position:relative;
}
.finding .finds {
width: 2000em;
margin-left: 0;
height:200px;
overflow:hidden;
}
.finding a {
float: left;
display: table-cell;
width: 200px;
height: 200px;
vertical-align: middle;
text-align: center;
overflow: hidden;
position:relative;
}
.finding img {
width: 200px;
height:200px;
}
.another {
margin-top: 10px;
}
.another .tick-bar {
float: left;
width: 150px;
height: 30px;
position: relative;
background: #F69;
}
.another .tick-bar .ticking { position:absolute;left:0;top:0;width:150px;height:30px;background:#ededed; } 
.another .tick-bar .tick-txt { position:absolute;left:0;top:0;width:100px;height:30px;line-height:30px;padding:0 0 0 10px;color:#666;background:none; } 
		</style><script type="text/javascript" >        $(function() {
	var $showResult = $("#J_ShowResult");
	var cmtHtml = "";
	var productId = $("#J_HiddenProductId").val();
	
	function getTime(){
		var now= new Date();
		var hour=now.getHours();
		var minute=now.getMinutes();
		var curTime = hour + ":" + minute;
		return curTime;
	}

	/* 发现喜欢 换一组 */
	var $changeGroupBtn = $("#J_ChangeGroupBtn");
	var $findGoods = $("#J_FindGoods");	
	var $finds = $(".finds");
	$finds.css("margin-left",-Math.floor(Math.random()*4)*200).show();//页面第一次加载的时候发现喜欢商品随机显示
	var findsItemLen = $finds.find(".finds-item").length;
	var ticking = null;	
	function changeFinds(){
		var seconds = 10;
		ticking = setInterval(function(){
			var width = $(".ticking").outerWidth();
			var newW = seconds==10 ? 150 : (width-15);
			$(".ticking").animate({
				width:newW+"px"
			},500);
			$(".tick-txt em").text(seconds);
			seconds -=1;		
			if(seconds==-1){
				seconds = 10;
				var ml = parseInt($finds.css("margin-left"));
				var itemW = (findsItemLen-1)*200;
				var newml = (ml==-itemW||ml<-itemW) ? 0 : ml-200+"px";
				var itemIndex = Math.abs(parseInt(newml)/200);
				changeInfo(itemIndex);
				/*$finds.animate({
					marginLeft:newml
				},1000);*/
				$finds.fadeOut(500,function(){
					$finds.css("margin-left",newml);
					$finds.fadeIn(500);
				});
			}
		},1000);		
	}
	changeFinds();
	
	function changeInfo(curItemIndex){
		var $finds = $(".finds");
		var $findsCount = $("#J_FindsCount");
		var $curfindsItem = $finds.find(".finds-item:eq(" + curItemIndex + ")");
		var dataLikeCnt = $curfindsItem.attr("data-likeCnt");
		var dataCommentCnt = $curfindsItem.attr("data-commentCnt");
		var dataSaleCnt = $curfindsItem.attr("data-saleCnt");
		$findsCount.find(".comment-num").text(dataCommentCnt).attr('title',dataCommentCnt+'评论');
		$findsCount.find(".sale-count").text(dataSaleCnt);	
		$changeGroupBtn.attr("data-index",curItemIndex);
	}
	
	//发现喜欢换一组数据交互
	var $changeGroupBtn = $("#J_ChangeGroupBtn");
	var $findGoods = $("#J_FindGoods");
	
	var isEnable = "true";//默认按钮可用
	$changeGroupBtn.click(function(){
		clearInterval(ticking);
		var $this = $(this);
		var $finds = $(".finds");
		var itemIndex = $this.attr("data-index");
		var findsItemLen = $finds.find(".finds-item").length;
		var nextIndex = (parseInt(itemIndex) >= (findsItemLen-1))?"0":parseInt(itemIndex)+1;
		var changeml = "-" + nextIndex*200 + "px";
		$finds.css("margin-left",changeml);
		changeInfo(nextIndex);
		changeFinds();
	});
});
</script>
</div>